#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include<QPainter>
#include<QImage>
#include<QPixmap>
#include<QTimer>
#include<QFile>
#include<ctime>
#include"backgroundrollingscene.h"
#include<QAudio>
#include"rollingaudioinputdevice.h"
#include"libpyincpp.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
extern QTimer globalTicker;
#define SAMPLE_RATE 8000
class QAudioInput;
class QMediaPlayer;
class QMediaPlaylist;
class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void paintEvent(QPaintEvent*);
    void keyPressEvent(QKeyEvent*);
private:
    Ui::MainWindow *ui;
    BackGroundRollingScene scene;
    RollingAudioInputDevice audioDevice;
    QAudioInput*audioInput;
    PyinCpp pyin;
    QFile file;
    QMediaPlayer*player;
    bool running;
    const int bgHeight=720;
    const int Width=1280,Height=720;
private slots:
    void tick();
    void onGameBegin(int gamemode);
    void onGameOver();
    void onGameRestart();
signals:
    void spaceControl(double);
};
#endif // MAINWINDOW_H
